<style tyle="text/css">
  .quick-btn {
    padding-top: 8px;
	color: #428bca;
  }
	.red {
		color: #f00
	}
</style>
<div class="col-lg-12 mt20">
  <div class="panel">
    <div class="panel-body">
      <div class="row col-lg-12">
        <label class="form-control-static col-lg-2" style="width: 13%; text-align: right">购买时间范围：</label>
        <div class="col-lg-2-4">
          <div class="input-group" ng-click="dateOpen($event, date)">
                <input type="text" class="form-control" datepicker-popup="yyyy-MM-dd" ng-model="date.lable" 
                is-open="date.opened" placeholder="开始时间" ng-required="true" 
                close-text="关闭" current-text="今天" clear-text="清除" readonly/>
                <span class="input-group-btn">
                  <button type="button" class="btn btn-default">
                    <i class="glyphicon glyphicon-calendar"></i>
                  </button>
                </span>
          </div>
        </div>
        <div class="col-lg-2-4">
          <div class="input-group" ng-click="dateOpen($event, date1)">
            <input type="text" class="form-control" datepicker-popup="yyyy-MM-dd" ng-model="date1.lable" 
             is-open="date1.opened" placeholder="截止时间" ng-required="true" 
             close-text="关闭" current-text="今天" clear-text="清除"  readonly/>
            <span class="input-group-btn">
              <button type="button" class="btn btn-default">
                <i class="glyphicon glyphicon-calendar"></i>
              </button>
            </span>
          </div>
		    </div>
		    <a class="btn btn-xs btn-link quick-btn" ng-click="today()">今天</a>
        <a class="btn btn-xs btn-link quick-btn" ng-click="yesterday()">昨天</a>
        <a class="btn btn-xs btn-link quick-btn" ng-click="thisWeek()">本周</a>
        <a class="btn btn-xs btn-link quick-btn" ng-click="lastWeek()">上周</a>
        <a class="btn btn-xs btn-link quick-btn" ng-click="thisMonth()">本月</a>
        <a class="btn btn-xs btn-link quick-btn" ng-click="lastMonth()">上月</a>
	  </div>
	  
      <div class="row col-lg-12 mt10">
		<label class="form-control-static col-lg-2" style="width: 13%; text-align: right">查询条件：</label>
		<div class="col-lg-2-4">
		  <input type="text" class="form-control" ng-model="searchform.person" placeholder="姓名/电话/身份证号">
		</div>
		<div class="col-lg-3">
		  <input type="text" class="form-control" ng-model="searchform.code" placeholder="订单编号">
		</div>
		<div class="col-lg-3 text-left">
		  <a class="btn btn-xs btn-link under-line" style="color: #428bca; vertical-align:-webkit-baseline-middle" 
		   ng-click="moreSearch()">更多搜索 
		  <i class="fa fa-caret-down" ng-show="!searchform.moreSearch"></i>
		  <i class="fa fa-caret-up" ng-show="searchform.moreSearch"></i>
		  </a>
		</div>
		<div class="col-lg-2">
		  <button class="btn btn-block btn-info" ng-click="load()">立即搜索</button> 
		</div>
	  </div>
      <div ng-show="searchform.moreSearch">
        <div class="row col-lg-12 mt10">
          <label class="form-control-static col-lg-2" style="width: 13%; text-align: right"></label>
          <div class="col-lg-2-4">
            <ui-select ng-model="searchform.ticket_state" theme="bootstrap">
              <ui-select-match placeholder="票状态">{{$select.selected.label}}</ui-select-match>
              <ui-select-choices repeat="item.value as item in tstate | filter: $select.search">
                <span ng-bind-html="item.label | highlight: $select.search"></span>
              </ui-select-choices>
            </ui-select>
          </div>
          <div class="col-lg-3">
            <ui-select ng-model="searchform.sale_category" theme="bootstrap">
              <ui-select-match placeholder="产品分类">{{$select.selected.label}}</ui-select-match>
              <ui-select-choices repeat="item.value as item in category_type">
                <span ng-bind-html="item.label | highlight: $select.search"></span>
              </ui-select-choices>
            </ui-select>
          </div>
          <div class="col-lg-3">
            <ui-select ng-model="searchform.place_code" theme="bootstrap">
              <ui-select-match placeholder="选择景区">{{$select.selected.name}}</ui-select-match>
              <ui-select-choices repeat="item.code as item in place_list | filter: $select.search">
								<span ng-bind-html="item.name | highlight: $select.search"></span>
								<span ng-show="item.code">({{item.code}})</span>
              </ui-select-choices>
            </ui-select>
          </div>
		  </div>
		<div class="row col-lg-12 mt10">
		  <label class="form-control-static col-lg-2" style="width: 13%; text-align: right"></label>
		  <div class="col-lg-2-4">
			<input type="text" class="form-control" ng-model="searchform.company_code" placeholder="分销商编号">
		  </div>
		  <div class="col-lg-3">
            <input type="text" class="form-control" ng-model="searchform.keyword" placeholder="订单标题">
          </div>
		  <div class="col-lg-3">
            <input type="text" class="form-control" ng-model="searchform.sale_code" placeholder="销售品编号">
          </div>
		</div>
		<div class="row col-lg-12 mt10">
		  <label class="form-control-static col-lg-2" style="width: 13%; text-align: right"></label>
		  <div class="col-lg-2-4">
				<ui-select ng-model="searchform.use_state" theme="bootstrap">
					<ui-select-match placeholder="票使用状态">{{$select.selected.label}}</ui-select-match>
					<ui-select-choices repeat="item.value as item in usestate">
						<span ng-bind-html="item.label | highlight: $select.search"></span>
					</ui-select-choices>
				</ui-select>
			</div>
		  <div class="col-lg-3">
				<div class="input-group" ng-click="dateOpen($event, tour_date)">
					<input type="text" class="form-control" datepicker-popup="yyyy-MM-dd" ng-model="tour_date.lable" 
						is-open="tour_date.opened" placeholder="游玩日期" ng-required="true" 
						close-text="关闭" current-text="今天" clear-text="清除"  readonly/>
					<span class="input-group-btn">
						<button type="button" class="btn btn-default">
							<i class="glyphicon glyphicon-calendar"></i>
						</button>
					</span>
				</div>
      </div>
		</div>

      </div>
    </div>
  </div>
	<!-- searchArea -->
	<div class="panel panel-default">
		<div class="panel-body">
			<table class="table table-condensed table-hover table-bordered">
				<thead>
					<tr>
						<th class="col-md-1 text-center">订单名称/编号</th>
						<!--<th class="col-md-2 text-center">订单编号</th>-->
						<th class="col-md-1 text-center">游客信息</th>
						<th class="col-md-1 text-center">数量</th>
						<th class="col-md-1 text-center">购买时间</th>
						<th class="col-md-1 text-center">销售品编号/分类</th>
						<th class="col-md-1 text-center">支付状态</th>
						<th class="col-md-1 text-center">出票状态</th>
						<th class="col-md-1 text-center">分销商</th>
						<th class="col-md-1 text-center">操作</th>
					</tr>
				</thead>
				<tbody>
					<tr ng-repeat="obj in objs">
						<td class="">
							{{obj.title}}
							<br>{{obj.code}}<br>
							<span ng-show="obj.out_order_id">外部分销：{{obj.out_order_id}}</span>
							<br> <span ng-show="obj.supply_order_id">供应商：{{obj.supply_order_id}}</span>
						</td>
						<td class="text-center">{{obj.name}}<br>{{obj.mobile}}<br>{{obj.cardno}}</td>
						<td class="text-center">
							<span>购买{{obj.num}}</span><br>
							<span>退票{{obj.back}}</span><br>
							<span>使用{{obj.used}}</span>
						</td>
						<td class="text-center">{{obj.create_time}}</td>
						<td class="text-center">
							{{obj.sale_code}}
							<br />{{obj.sale_category_name}}
						</td>
						<td class="text-center">
							<p ng-show="obj.pay_state==0" class="form-control-static">未支付</p>
							<p ng-show="obj.pay_state==2" class="form-control-static red">游客已支付,但转分销产品预存扣款失败,3分钟后自动退款.<br/>
							<p ng-show="obj.pay_state==3" class="form-control-static">供应商预存扣款失败,已退款处理.<br/>
							<p ng-show="obj.pay_state==1" class="form-control-static">支付完成<br/>(
								<span ng-show="obj.payment_type==1" class="form-control-static">支付宝支付</span>
								<span ng-show="obj.payment_type==2" class="form-control-static">微信支付</span>
								<span ng-show="obj.payment_type==3" class="form-control-static">网银在线</span>
								<span ng-show="obj.payment_type==4" class="form-control-static">平台余额</span>
								<span ng-show="obj.payment_type==5" class="form-control-static">现金支付</span>
								<span ng-show="obj.payment_type==6" class="form-control-static">供应商预存</span>
								<span ng-show="obj.payment_type==8" class="form-control-static">同业支付</span>
								<span ng-show="obj.payment_type==9" class="form-control-static">半价支付</span>)
							</p>
						</td>
						<td class="text-center">
							<!-- <span popover="{{obj.cancel_reason}}" popover-trigger="mouseenter">{{obj.ticket_state_name}}</span> -->
							<!--<br>-->
							{{obj.ticket_state_name}}
							<!-- <button popover="{{obj.cancel_reason}}" popover-trigger="mouseenter" class="btn btn-success">Mouseenter</button> -->
							<span ng-show="obj.ticket_state == 9 || obj.ticket_state == 7">
								<br>{{obj.cancel_reason}}
							</span>
						</td>
						<td class="text-center">{{obj.company_name}}<br>{{obj.company_code}}<br>{{obj.operation_login_name}}</td>
						<td class="text-center">
							<a ng-click="ticketlist(obj)" class="btn btn-success btn-xs">票信息</a>
							<br>
							<a ng-click="orderinfo(obj)" class="btn btn-info btn-xs">订单详情</a>
							<br>
							<a ng-click="resend(obj)" class="btn btn-danger btn-xs" ng-show="obj.sale_belong != 'juyou' || (obj.ticket_state == '2' && obj.sms_state == '2')">重发短信</a>
							<a ng-click="relay(obj)" class="btn btn-warning btn-xs" ng-show="obj.sale_belong != 'juyou' || (obj.ticket_state == '2' && obj.sms_state == '2')">转发短信</a>
							<a ng-click="userMsg(obj)" class="btn btn-info btn-xs" ng-show="obj.uid && obj.uid != 'null'">个人信息</a>
							<a ng-click="skv4Profit(obj)" class="btn btn-info btn-xs" ng-show="obj.from_app_id == 'SKv4'">分润信息</a>
							<a ng-click="back(obj, '1')" class="btn btn-primary btn-xs" ng-show="(obj.num > obj.back + obj.used) && ((obj.sale_belong != 'langdao' && obj.ticket_state == '2') || obj.ticket_state == '9' || obj.ticket_state == '7') "
								>退票</a>
							<!-- <a ng-if="obj.sale_belong != 'juyou' && obj.ticket_state == '9'" ng-click="back(obj, '2')" class="btn btn-primary btn-xs" ng-show="(obj.num > obj.back + obj.used) && ((obj.sale_belong != 'langdao' && obj.ticket_state == '2') || obj.ticket_state == '9') "
								 has-permission='backTicket_new'
								 >退多张票</a> -->
						</td>
					</tr>
				</tbody>
			</table>
			<div class="text-right" style="background-color: white">
				<pagination total-items="bigTotalItems" ng-model="bigCurrentPage" max-size="maxSize" class="pagination-sm" boundary-links="true"
				 ng-change="load()" items-per-page="itemsPerPage" previous-text="上一页" next-text="下一页" first-text="首页" last-text="末页" rotate="false">
				</pagination>
			</div>
		</div>
	</div>
</div>
